package servidor.bbdd.subsistema1;

import static org.junit.Assert.*;
import org.junit.Test;
import servidor.bbdd.GestorDiscoConexion;
import common.EOlympicsException;
import beans.*;


public class GestorSubsistema1Test {

	@Test
	public void testGetLogin() {
		GestorDiscoConexion gbd = new GestorDiscoConexion();
		try { gbd.conectarBD(); } catch (EOlympicsException e) { fail(e.getLocalizedMessage()); }
		GestorSubsistema1 gs1 = new GestorSubsistema1(gbd);
		Usuari u = null;
		try { u = gs1.getLogin("0","0"); } catch (EOlympicsException e) { assertTrue(true); }
		assertNull(u);
		
		u = null;
		try { u = gs1.getLogin("20","kk2"); } catch (EOlympicsException e) { fail("mai hauria d'arribar aqui doncs l'usuari existeix en la base de dades"); }
		assertNotNull(u);
		assertTrue("Teresa".equals(u.getNom()));
		assertTrue("Garcia".equals(u.getCognom1()));
		assertTrue("Gilabert".equals(u.getCognom2()));
		assertTrue("20".equals(u.getIdUsuari()));
		System.out.println("#" + u.getPwd() + "#");
		assertTrue("kk2".equals(u.getPwd()));	
	}

	@Test
	public void testBloquejarUsuari() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetUser() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetBusqueda() {
		fail("Not yet implemented");
	}

	@Test
	public void testAddUser() {
		fail("Not yet implemented");
	}

	@Test
	public void testUpdateUser() {
		fail("Not yet implemented");
	}

	@Test
	public void testDeleteUser() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetInscripcions() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetProves() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetRondes() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetParticipacions() {
		fail("Not yet implemented");
	}

}
